home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1996 #15 / Monster Media Number 15 (Monster Media)(July 1996).ISO / prog_c / lsdoor09.zip / LORDDEMO.CPP < prev    next >
C/C++ Source or Header  |  1996-06-03  |  4KB  |  108 lines

  1. // LordDemo.Cpp - This example demonstrates how to use the LORD IGM features
  2. //   from the LsDoor SDK.
  3.  
  4. // * This example assumes some knowledge of the LsDoor SDK.
  5.  
  6. // * This example shows only SOME of the LORD IGM features.  For a complete
  7. // reference, refer to LORD.H.
  8.  
  9. // * Note that in the registered LsDoor SDK you must add LORD.CPP to your
  10. // project before compiling this program.
  11.  
  12. #define MainModule
  13. #include "LsDoor.h"
  14. #include "Lord.h"
  15.  
  16. char *errorModule( void ){ return "LordDemo"; }
  17.  
  18. char demoExe[80];
  19.  
  20. void main( void )
  21. {
  22.   char c;
  23.   LORD_Mail *mess;
  24.  
  25.   strcpy( demoExe, _argv[0] );
  26.     // demoExe now holds the path & filename being run.  Ex: C:\LordDemo.Exe
  27.  
  28.     // You may want to change into your game's working directory at this
  29.     // point.  When LORD runs your program, you will still be in the LORD
  30.     // directory, but because there is always the possibility the sysop will
  31.     // want to play in local mode, you should not assume that you are
  32.     // always in the LORD directory.  
  33.  
  34.   if( !LORD_Init( "." ) ){                    // LORD_Init( path_to_lord );
  35.     display("\nThis demo must be in the same directory as LORD.\n");
  36.     exit(99);
  37.   }
  38.  
  39.   while( online )
  40.   {
  41.     display("@{0}@g");
  42.     s_cls();
  43.     display(
  44.       "\nMenu..."
  45.       "\n"
  46.       "\n  (1).. Try swearing"
  47.       "\n  (2).. Send yourself mail"
  48.       "\n  (I).. Install into LORD (Normally done from an install utility)"
  49.       "\n  (U).. UnInstall from LORD (Normally done from an uninstall utility)"
  50.       "\n  (X).. Exit the IGM (Back to LORD)"
  51.       "\n"
  52.       "\nYour choice, warrior? "
  53.       );
  54.     c = toupper( s_in() );
  55.     switch( c )
  56.     {
  57.       case '1':
  58.         display( "\n\nBrave soul, enter thy foul words: \n" );
  59.         s_gets( temp, 80 );
  60.         LORD_FixBadWords( temp );
  61.         display( "\n\nI have heard ye.\n%s\n\nPress any key.", temp );
  62.         s_in();
  63.         break;
  64.  
  65.       case '2':
  66.         mess = new LORD_Mail( LORDPlayer.account );
  67.         mess->AddText( "`%  Message from yourself.." );
  68.         mess->AddText( "`0-=-=-=-=-=-=-=-=-=-=-=-=-=-" );
  69.         mess->AddText( "  The LsDoor SDK provides excellent support for LORD" );
  70.         mess->AddText( "including sending mail.  Using the LsDoor SDK, you can" );
  71.         mess->AddText( "also send charm, experience, skill, and much more" );
  72.         mess->AddText( "through LORD's mail." );
  73.         mess->AddText( " " );
  74.         mess->AddText( "`5     +400 Experience   +5000 Gold   +1 Charm   +3 Skill" );
  75.         mess->AddExp( 400 );
  76.         mess->AddMoney( 5000 );
  77.         mess->AddCharm();
  78.         mess->AddSkill( 3 );
  79.         delete mess;    // This causes the message to be sent.  Don't spend more than
  80.                         // 3 seconds between the 'new' and 'delete' of a message.
  81.                         // (C++ Rule) Always 'delete' any data created with 'new'.
  82.         display("\nThe message is sent.  You will not receive the message until");
  83.         display("\nyou return to LORD.  Press any key.");
  84.         s_in();
  85.         break;
  86.  
  87.       case 'I':
  88.         strcpy( temp, demoExe );
  89.         strcat( temp, " /N*" );
  90.         LORD_Install( "`$LordDemo", temp );
  91.         display("\n@WTis done...Press any key."); s_in();
  92.         break;
  93.  
  94.       case 'U':
  95.         strcpy( temp, "LordDemo.Exe" );
  96.         LORD_UnInstall( temp );
  97.         display("\n@WTis done...Press any key."); s_in();
  98.         break;
  99.  
  100.       case 'X': display( "\n@WFarewell..." ); exit(0);
  101.     }
  102.   }
  103.   exit( 0 );
  104. }
  105.  
  106. // End of LordDemo.Cpp
  107.  
  108.